<%-- 
    Document   : planSearchResults
    Created on : May 2, 2012, 7:41:05 PM
    Author     : Kyle
--%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <LINK REL=StyleSheet HREF="./css/main.css" TYPE="text/css">
        <script src="./js/prototype.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
        <script src="./js/datepicker.js"></script>
    </head>
    <body>
        <div class="filler">
            <div class="bg">
                <div class="main">
                    <div class="hdr">
                        <div class="logo">
                            <img src="./imgs/logo.png"/>
                        </div>

                        <div class="hdr_content_container">
                            <div class="acct_btns" style="margin-top : 10px;">
                                <div class="acct_btn">
                                    <a href="accountSettings.jsp">Account Settings</a>
                                </div>
                                <div class="acct_btn">
                                    <a href="LoginServlet?action=logout">Log Out</a>
                                </div>
                            </div>

                            <div class="acct_btns" style="margin-top: 75px;">
                                <div class="acct_btn">
                                    <a href="dashboard.jsp">Home</a>
                                </div>
                                <div class="acct_btn">
                                    <a href="calendar.jsp">Calendar</a>
                                </div>
                                <div class="acct_btn">
                                    <a href="plans.jsp">Plans</a>
                                </div>
                                <div class="acct_btn">
                                    <a href="data.jsp">Data</a>
                                </div>
                                <div class="acct_btn">
                                    <a href="friends.jsp">Friends</a>
                                </div>

                            </div>
                        </div>
                    </div>
                    <!-- hdr -->

                    <div class="container">
                        <h1>Search Results</h1>
                        <c:set var="numPlans" scope="session">
                            0
                        </c:set>
                        <c:forEach items="${searchedPlans.listPlans}" var="plan" varStatus="loopCount">
                            <div class="plansview_list">
                                ${plan.planName}
                                <c:if test="${!plan.joined}">
                                    <a href="javascript:showDatePicker(${loopCount.count})">
                                        Join
                                    </a>
                                </c:if>
                                &nbsp;
                            </div>
                            <div id="datePicker${loopCount.count}" style="display:none">
                                <form action="Plans" method="post" >
                                    Year: <input type="text" name="year"></input><br/>
                                    Month: <input type="text" name="month"></input><br/>
                                    Day: <input type="text" name="day"></input><br/>
                                    <input type="hidden" name="action" value="join"></input>
                                    <input type="hidden" name="planId" value="${plan.planID}"></input>
                                    <input type="submit" value="Join!"></input><br/>
                                    <input type="hidden" name="from" value="search"></input>
                                </form>
                            </div>
                            <c:set var="numPlans" scope="session">
                                ${numPlans+1}
                            </c:set>
                        </c:forEach>
                        <c:if test = "${numPlans eq 0}">
                            <h3>Your search returned zero results.</h3>
                        </c:if>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
